﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace Yottamud_2013_v3_Main
{
    class XMLUtility
    {

        public static void WriteToXML<T>(T iOutput, String iFileName)
        {
            XmlSerializer outputXml = new XmlSerializer(typeof(T));

            TextWriter tWriter = new StreamWriter(iFileName);

            outputXml.Serialize(tWriter, iOutput);

            tWriter.Close();
        }

        public static void ReadFromXML<T>(out T iInput, String iFile)
        {
            XmlSerializer deSerial = new XmlSerializer(typeof(T));

            TextReader tReader = new StreamReader(iFile);

            iInput = (T)deSerial.Deserialize(tReader);

            tReader.Close();
        }
        
    }
}
